package com.moonciki.artadmin.web.controller.test;

import com.moonciki.artadmin.core.base.BaseController;
import com.moonciki.artadmin.core.model.PageParameter;
import com.moonciki.artadmin.core.model.WebResult;
import com.moonciki.artadmin.web.service.hello.HelloWorldService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "000.测试接口类")
@Slf4j
@RestController
@RequestMapping("/hello")
public class HelloWorldController extends BaseController {

    @Autowired
    HelloWorldService helloWorldService;

    @ApiOperation(value = "hello world")
    @GetMapping("/hello")
    public WebResult helloWorld(PageParameter pageParameter) {

        log.info("testHello @@@@@@@@@@@");

        helloWorldService.helloWorld(pageParameter);

        WebResult resp = WebResult.successResponse();

        return resp;
    }

    @ApiOperation(value = "缓存测试")
    @GetMapping("/cacheTest")
    public WebResult<String> cacheTest(String key) {

        log.info("cacheTest : " + key);

        String s = helloWorldService.cacheTest(key);

        WebResult<String> resp = WebResult.successResponse(s);

        return resp;
    }

}
